package org.jugile.demo.domain;


import org.jugile.util.HiLo;
import org.jugile.util.Jugile;

import org.jugile.demo.common.*;


public class World extends Jugile {

	private static boolean load = true;

	public static void main(String args[]) {
		load = false;
		HiLo.setHasdb(false); // disable db
		Domain d = Domain.getDomain("noload"); // calls init	
		d.saveToCsvZip("domain.csv.zip");
		//d.saveToCsv("domain.csv");
		print("done.");
		load = true;
	}
	
	public static void init(Domain d, String tag) {
		// create initial test world
		if (load) {
			// load from file or db
			if (HiLo.hasdb()) {

			} else {
				// load csv
				//d.loadFromCsv("domain.csv");
				d.loadFromCsvZip("domain.csv.zip");
			}
		} else {
			// create test objects - NOTE: no commit because write csv from delta
			Author a = d.createAuthor().setName("Waltari");
			a.createBook("Sinuhe");
			a.createBook("Johannes Angelos");
			
		}
	}
	
}